package com.lg.erp.service.impl.jml;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lg.erp.entity.jml.TStaff;
import com.lg.erp.mapper.jml.TStaffMapper;
import com.lg.erp.service.jml.ITStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jml
 * @since 2021-04-12
 */
@Service
public class TStaffServiceImpl extends ServiceImpl<TStaffMapper, TStaff> implements ITStaffService {

    @Autowired
    private TStaffMapper staffMapper;
    @Override
    public IPage<TStaff> selectStaffByPage(Page<TStaff> page) {
        return staffMapper.selectStaffByPage(page);
    }

    @Override
    public List<TStaff> selectStaff(Integer current, String name, String dId) {
        if (name!=null && name!="null"){
            name="%"+name+"%";
        }
        current=(current-1)*10;
        List<TStaff> tStaffs = staffMapper.selectStaff(current, name, dId);
        return tStaffs;
    }

    @Override
    public void update(String account_status,String id) {
        staffMapper.update(account_status,id);
    }

    @Override
    public List<TStaff> selectAll() {
        return staffMapper.selectAll();
    }

    @Override
    public List<TStaff> selectAllStatus() {
        return staffMapper.selectAllStatus();
    }

    @Override
    public void add(TStaff staff) {
        staffMapper.add(staff);
    }
}
